<?php
/**
 * Description
 * 
 * PHP version 7
 * 
 * @category Custom
 * @package  Custom
 * @author   ryu <mo5467@126.com>
 * @date     2020-04-24 00:23:29
 * @lastTime 2020-05-01 23:06:18
 * @license  https://opensource.org/licenses/MIT MIT License
 * @link     none
 */

namespace Test\Unit;

use Design\Structural\Bridge\PingService;
use Design\Structural\Bridge\HtmlFormatter;
use Design\Structural\Bridge\HelloWorldService;
use Design\Structural\Bridge\PlainTextFormatter;

class BridgeTest extends \Test\BaseTest
{


    public function testCanPrintWithHtmlFormatter()
    {
        $service = new HelloWorldService(new HtmlFormatter());

        $this->assertSame('<p>Hello World</p>', $service->get());

    }//end testCanPrintWithHtmlFormatter()


    public function testCanPrintWithPlainTextFormatter()
    {
        $service = new PingService(new PlainTextFormatter());

        $this->assertSame('ping', $service->get());

        $service->setImplementation(new HtmlFormatter());
        $this->assertSame('<p>ping</p>', $service->get());

    }//end testCanPrintWithPlainTextFormatter()


}//end class
